package com.shanzmoo.db.mall.entity.vo;

import com.alibaba.fastjson.JSON;
import com.shanzmoo.db.mall.entity.MallOrderDetailEntity;
import com.shanzmoo.db.order.entity.dto.MallOrderDeatilRedisDTO;
import io.swagger.annotations.ApiModel;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 *
 *
 * @author： Gzhao 2021/2/3
 */
@Data
@ApiModel("商城订单明细信息")
public class MallOrderDetailVO implements Serializable {

    private static final long serialVersionUID = 1758L;


    /**
     * 订单id
     */
    private Integer orderId;

    /**
     * 商品sku
     */
    private String sku;

    /**
     * 商品名称
     */
    private String spuName;

    /**
     * 商品图片
     */
    private String pictureUrl;

    /**
     * 商品单位
     */
    private String unit;

    /**
     * sku数量
     */
    private Integer skuNum;

    /**
     * 规格属性描述
     */
    private String attributeDesc;

    /**
     * 商品总价
     */
    private BigDecimal totalPrice;

    /**
     * 商品单价
     */
    private BigDecimal unitPrice;


    public static MallOrderDetailVO create(MallOrderDetailEntity mallOrderDetailEntity) {
        return JSON.parseObject(JSON.toJSONString(mallOrderDetailEntity), MallOrderDetailVO.class);
    }

    public static List<MallOrderDetailVO> createList(List<MallOrderDeatilRedisDTO> orderDetailList) {
        return JSON.parseArray(JSON.toJSONString(orderDetailList), MallOrderDetailVO.class);
    }
}
